<template>
	<view style="padding: 2%;">
		<view v-for="(item, index) in appList" :key="item.appId" style="border-bottom: 1rpx solid #C0C0C0;">
			<view style="display: flex;width: 100%;padding: 20rpx;">
				<view><img style="width: 80rpx;height: 80rpx;" :src="item.appOrgAvatar" alt="">
				</view>
				<view style="margin-left: 20rpx;width: 85%;">
					<view style="display: flex;justify-content: space-between;">
						<view>{{item.appOrgName}}</view>
						<view>
							<u-tag v-if="item.appStatus=='AGREE'" text="已同意" type="success" mode="plain" size="mini" />
							<u-tag v-if="item.appStatus=='REFUSE'" text="已拒绝" type="error" mode="plain" size="mini" />
							<u-tag v-if="item.appStatus=='undetermined'" text="待审批" type="info" mode="plain"
								size="mini" />
						</view>
					</view>
					<view style="font-size: smaller;color: #808080;margin-top: 10rpx;">
						<span v-if="item.appStatus=='undetermined'">已提交申请，请等待社团管理员审批</span>
						<span v-if="item.appStatus=='AGREE'">恭喜加入 [{{item.appOrgName}}]</span>
						<span v-if="item.appStatus=='REFUSE'">拒绝原因：{{item.appRefuseReason}}</span>
					</view>
					<view style="font-size: smaller;color: #808080;margin-top: 10rpx;text-align: right;">
						{{item.createAt}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				appList: []
			}
		},
		onLoad() {
			this.getOrgApplication()
		},
		methods: {
			getOrgApplication() {
				this.$http.request({
					url: `/organizations/web/organization/appList/`
				}).then(res => {
					res = res.data;
					if (res.result) {
						this.appList = res.data;
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				})
			}
		}
	}
</script>

<style>
</style>
